<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>css绘制六边形</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }
    body {
        width: 100%;
    }
    .box {
        position: relative;
        width: 200px;
        margin: 50px auto;
    }
    .square1, .square2, .square3 {
        width: 100px;
        height: 173.2px;
        border: 2px solid rgb(194,194,194);
        position: absolute;
        top: 0;
        left: 0;
        transform-origin: center center;
        border-right-color: transparent;
        border-left-color: transparent;
        border-radius: 1px;
    }
    .square2 {
        transform: rotateZ(60deg);
    }
    .square3 {
        transform: rotateZ(-60deg);
    }
    .hexagon1 {
        width: 90px;
        height: 155px;
        position: absolute;
        border: 1px solid #ccc;
        background: #ccc;
        top: 11px;
        left: 6px;
        box-sizing: border-box;
    }

    .hexagon1::before {
        content: "";
        width: 0;
        border-top: 77px;
        border-right: 45px;
        border-bottom: 77px;
        border-left: 45px;
        border-style: solid;
        border-color: transparent #ccc transparent transparent;
        position: absolute;
        left: -91px;
        top: 0;
    }

    .hexagon1::after {
        content: "";
        width: 0;
        border-top: 77px;
        border-right: 45px;
        border-bottom: 77px;
        border-left: 45px;
        border-style: solid;
        border-color: transparent transparent transparent #ccc;
        position: absolute;
        left: 89px;
        top: 0;
    }
    
</style>
<body>
    <div class="box">
        <div class="square1"></div>
        <div class="square2"></div>
        <div class="square3"></div>
        <div class="hexagon1"></div>
    </div>
</body>
</html>